<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    function Parent(msg){
        this.msg = msg;
        this.show = function(){
            console.log(this.msg)
        }
    }
    Parent.prototype.init = function(){
        console.log("这是init", this.msg);
    }

    function Child(){}

    Child.prototype = new Parent("world");
    Child.prototype.init = function(){
        console.log("这是修改后的init");
    }

    const p = new Parent("hello");
    console.log(p);
    p.init();
    p.show();
    // 正常的原型链：
    // 实例p的__proto__ 指向 Parent的prototype

    const c = new Child();
    console.log(c);
    c.init();
    c.show();
    // 原型链继承后的原型链：
    // 实例c的__proto__ 指向 Child的prototype(Parent的实例)，Child的prototype(Parent的实例)的__proto__ 指向 Parent的prototype
    

    
</script>
</html>